import java.util.Scanner;

public class Main {
    public String administrator = "123456";
    public String password = "admin";

    public void loginInfo(String administrator, String password)throws UsernameException, PasswordException{
        if(!this.administrator.equals(administrator)){
            throw new UsernameException("账号输入错误！");
        }
        if(!this.password.equals(password)){
            throw new PasswordException("密码输入错误");
        }
        System.out.println("登录成功");
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入账号:");
        String username = sc.nextLine();
        System.out.println("请输入密码:");
        String password = sc.nextLine();

        
        try{
            Main main=new Main();
            main.loginInfo(username, password);
        }catch (UsernameException e){
            e.printStackTrace();
        }catch (PasswordException e){
            e.printStackTrace();
        }finally {
            sc.close();
        }

    }
}
